#!/bin/sh

LOG_PATH=./logs/tss.log
TSS_BASIC_AUTH=
TSS_HTTP_PORT=8080

dir=`pwd`

cat > /lib/systemd/system/tss.service <<EOF
[Unit]
Description=tss
After=network.target

[Service]
Type=simple
WorkingDirectory=${dir}
ExecStart=${dir}/tss
Restart=always
RestartSec=5s
TimeoutSec=5s
Environment=TSS_LOG_PATH=${LOG_PATH}
Environment=TSS_BASIC_AUTH=${TSS_BASIC_AUTH}
Environment=TSS_HTTP_PORT=${TSS_HTTP_PORT}


[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl start tss
systemctl enable tss
echo 'systemctl status tss'